package com.tanhua.server.controller;

import com.tanhua.server.service.PeachBlossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping
public class PeachBlossomController {

    @Autowired
    private PeachBlossomService peachBlossomService;

    //发送语音
    @PostMapping("/peachblossom")
    public ResponseEntity<Object> uploadFile(@RequestBody MultipartFile soundFile) throws IOException {
        return peachBlossomService.upload(soundFile);
    }

    //获取语音
    @GetMapping("/peachblossom")
    public ResponseEntity<Object> getFile(){
        return peachBlossomService.get();
    }
}
